\(\int (g+h x) (A+B \log (e (a+b x)^n (c+d x)^{-n}))^2 \, dx\) [304]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F(-1)]
   Fricas [F]
   Sympy [F(-2)]
   Maxima [B] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 31, antiderivative size = 294 \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\frac {B^2 (b c-a d)^2 h n^2 \log (c+d x)}{b^2 d^2}-\frac {B (b c-a d) h n (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d}+\frac {B (b c-a d) (2 b d g-b c h-a d h) n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d^2}-\frac {(b g-a h)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 b^2 h}+\frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}+\frac {B^2 (b c-a d) (2 b d g-b c h-a d h) n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 d^2} \]

[Out]

B^2*(-a*d+b*c)^2*h*n^2*ln(d*x+c)/b^2/d^2-B*(-a*d+b*c)*h*n*(b*x+a)*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))/b^2/d+B*(-
a*d+b*c)*(-a*d*h-b*c*h+2*b*d*g)*n*ln((-a*d+b*c)/b/(d*x+c))*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))/b^2/d^2-1/2*(-a*h
+b*g)^2*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2/b^2/h+1/2*(h*x+g)^2*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2/h+B^2*(-a*
d+b*c)*(-a*d*h-b*c*h+2*b*d*g)*n^2*polylog(2,d*(b*x+a)/b/(d*x+c))/b^2/d^2

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 294, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.290, Rules used = {2573, 2553, 2398, 2404, 2338, 2351, 31, 2354, 2438} \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\frac {B n (b c-a d) (-a d h-b c h+2 b d g) \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )}{b^2 d^2}-\frac {(b g-a h)^2 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2}{2 b^2 h}-\frac {B h n (a+b x) (b c-a d) \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )}{b^2 d}+\frac {(g+h x)^2 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2}{2 h}+\frac {B^2 n^2 (b c-a d) (-a d h-b c h+2 b d g) \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 d^2}+\frac {B^2 h n^2 (b c-a d)^2 \log (c+d x)}{b^2 d^2} \]

[In]

Int[(g + h*x)*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2,x]

[Out]

(B^2*(b*c - a*d)^2*h*n^2*Log[c + d*x])/(b^2*d^2) - (B*(b*c - a*d)*h*n*(a + b*x)*(A + B*Log[(e*(a + b*x)^n)/(c
+ d*x)^n]))/(b^2*d) + (B*(b*c - a*d)*(2*b*d*g - b*c*h - a*d*h)*n*Log[(b*c - a*d)/(b*(c + d*x))]*(A + B*Log[(e*
(a + b*x)^n)/(c + d*x)^n]))/(b^2*d^2) - ((b*g - a*h)^2*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2)/(2*b^2*h) +
 ((g + h*x)^2*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2)/(2*h) + (B^2*(b*c - a*d)*(2*b*d*g - b*c*h - a*d*h)*n
^2*PolyLog[2, (d*(a + b*x))/(b*(c + d*x))])/(b^2*d^2)

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 2338

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))/(x_), x_Symbol] :> Simp[(a + b*Log[c*x^n])^2/(2*b*n), x] /; FreeQ[{a
, b, c, n}, x]

Rule 2351

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_) + (e_.)*(x_)^(r_.))^(q_), x_Symbol] :> Simp[x*(d + e*x^r)^(q +
 1)*((a + b*Log[c*x^n])/d), x] - Dist[b*(n/d), Int[(d + e*x^r)^(q + 1), x], x] /; FreeQ[{a, b, c, d, e, n, q,
r}, x] && EqQ[r*(q + 1) + 1, 0]

Rule 2354

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[Log[1 + e*(x/d)]*((a +
b*Log[c*x^n])^p/e), x] - Dist[b*n*(p/e), Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[
{a, b, c, d, e, n}, x] && IGtQ[p, 0]

Rule 2398

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_) + (e_.)*(x_))^(q_)*((f_) + (g_.)*(x_))^(m_.), x_Symbol]
:> Simp[(f + g*x)^(m + 1)*(d + e*x)^(q + 1)*((a + b*Log[c*x^n])^p/((q + 1)*(e*f - d*g))), x] - Dist[b*n*(p/((q
 + 1)*(e*f - d*g))), Int[(f + g*x)^(m + 1)*(d + e*x)^(q + 1)*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{
a, b, c, d, e, f, g, m, n, q}, x] && NeQ[e*f - d*g, 0] && EqQ[m + q + 2, 0] && IGtQ[p, 0] && LtQ[q, -1]

Rule 2404

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(RFx_), x_Symbol] :> With[{u = ExpandIntegrand[(a + b*Log[c*x^
n])^p, RFx, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[{a, b, c, n}, x] && RationalFunctionQ[RFx, x] && IGtQ[p, 0]

Rule 2438

Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2, (-c)*e*x^n]/n, x] /; FreeQ[{c, d,
 e, n}, x] && EqQ[c*d, 1]

Rule 2553

Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*(B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m
_.), x_Symbol] :> Dist[b*c - a*d, Subst[Int[(b*f - a*g - (d*f - c*g)*x)^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m +
 2)), x], x, (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] && NeQ[b*c - a*d, 0] && Inte
gerQ[m] && IGtQ[p, 0]

Rule 2573

Int[((A_.) + Log[(e_.)*(u_)^(n_.)*(v_)^(mn_)]*(B_.))^(p_.)*(w_.), x_Symbol] :> Subst[Int[w*(A + B*Log[e*(u/v)^
n])^p, x], e*(u/v)^n, e*(u^n/v^n)] /; FreeQ[{e, A, B, n, p}, x] && EqQ[n + mn, 0] && LinearQ[{u, v}, x] &&  !I
ntegerQ[n]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int (g+h x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \, dx,e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = \text {Subst}\left ((b c-a d) \text {Subst}\left (\int \frac {(b g-a h-(d g-c h) x) \left (A+B \log \left (e x^n\right )\right )^2}{(b-d x)^3} \, dx,x,\frac {a+b x}{c+d x}\right ),e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = \frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}-\text {Subst}\left (\frac {(B n) \text {Subst}\left (\int \frac {(b g-a h+(-d g+c h) x)^2 \left (A+B \log \left (e x^n\right )\right )}{x (b-d x)^2} \, dx,x,\frac {a+b x}{c+d x}\right )}{h},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = \frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}-\text {Subst}\left (\frac {(B n) \text {Subst}\left (\int \left (\frac {(b g-a h)^2 \left (A+B \log \left (e x^n\right )\right )}{b^2 x}+\frac {(b c-a d)^2 h^2 \left (A+B \log \left (e x^n\right )\right )}{b d (b-d x)^2}+\frac {(b c-a d) h (2 b d g-b c h-a d h) \left (A+B \log \left (e x^n\right )\right )}{b^2 d (b-d x)}\right ) \, dx,x,\frac {a+b x}{c+d x}\right )}{h},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = \frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}-\text {Subst}\left (\frac {\left (B (b c-a d)^2 h n\right ) \text {Subst}\left (\int \frac {A+B \log \left (e x^n\right )}{(b-d x)^2} \, dx,x,\frac {a+b x}{c+d x}\right )}{b d},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right )-\text {Subst}\left (\frac {\left (B (b g-a h)^2 n\right ) \text {Subst}\left (\int \frac {A+B \log \left (e x^n\right )}{x} \, dx,x,\frac {a+b x}{c+d x}\right )}{b^2 h},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right )-\text {Subst}\left (\frac {(B (b c-a d) (2 b d g-b c h-a d h) n) \text {Subst}\left (\int \frac {A+B \log \left (e x^n\right )}{b-d x} \, dx,x,\frac {a+b x}{c+d x}\right )}{b^2 d},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = -\frac {B (b c-a d) h n (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d}+\frac {B (b c-a d) (2 b d g-b c h-a d h) n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d^2}-\frac {(b g-a h)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 b^2 h}+\frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}+\text {Subst}\left (\frac {\left (B^2 (b c-a d)^2 h n^2\right ) \text {Subst}\left (\int \frac {1}{b-d x} \, dx,x,\frac {a+b x}{c+d x}\right )}{b^2 d},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right )-\text {Subst}\left (\frac {\left (B^2 (b c-a d) (2 b d g-b c h-a d h) n^2\right ) \text {Subst}\left (\int \frac {\log \left (1-\frac {d x}{b}\right )}{x} \, dx,x,\frac {a+b x}{c+d x}\right )}{b^2 d^2},e \left (\frac {a+b x}{c+d x}\right )^n,e (a+b x)^n (c+d x)^{-n}\right ) \\ & = \frac {B^2 (b c-a d)^2 h n^2 \log (c+d x)}{b^2 d^2}-\frac {B (b c-a d) h n (a+b x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d}+\frac {B (b c-a d) (2 b d g-b c h-a d h) n \log \left (\frac {b c-a d}{b (c+d x)}\right ) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b^2 d^2}-\frac {(b g-a h)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 b^2 h}+\frac {(g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{2 h}+\frac {B^2 (b c-a d) (2 b d g-b c h-a d h) n^2 \text {Li}_2\left (\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 d^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.58 (sec) , antiderivative size = 472, normalized size of antiderivative = 1.61 \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\frac {a B^2 d^2 (-2 b g+a h) n^2 \log ^2(a+b x)-2 B n \log (a+b x) \left (b^2 B c (-2 d g+c h) n \log (c+d x)-B (b c-a d) (-2 b d g+b c h+a d h) n \log \left (\frac {b (c+d x)}{b c-a d}\right )+a d \left (A (-2 b d g+a d h)+B (-2 b d g+b c h-a d h) n+B d (-2 b g+a h) \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )\right )+b \left (b B^2 c (-2 d g+c h) n^2 \log ^2(c+d x)+2 B n \log (c+d x) \left (A b c (-2 d g+c h)+B \left (b c^2 h-a d (2 d g+c h)\right ) n+b B c (-2 d g+c h) \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )+d \left (A b x (2 A d g-2 B c h n+A d h x)+2 a B n (-2 A d g-2 B d g n+B c h n+A d h x)+2 B (a B d n (-2 g+h x)+b x (2 A d g-B c h n+A d h x)) \log \left (e (a+b x)^n (c+d x)^{-n}\right )+b B^2 d x (2 g+h x) \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )\right )\right )+2 B^2 (b c-a d) (-2 b d g+b c h+a d h) n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{-b c+a d}\right )}{2 b^2 d^2} \]

[In]

Integrate[(g + h*x)*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2,x]

[Out]

(a*B^2*d^2*(-2*b*g + a*h)*n^2*Log[a + b*x]^2 - 2*B*n*Log[a + b*x]*(b^2*B*c*(-2*d*g + c*h)*n*Log[c + d*x] - B*(
b*c - a*d)*(-2*b*d*g + b*c*h + a*d*h)*n*Log[(b*(c + d*x))/(b*c - a*d)] + a*d*(A*(-2*b*d*g + a*d*h) + B*(-2*b*d
*g + b*c*h - a*d*h)*n + B*d*(-2*b*g + a*h)*Log[(e*(a + b*x)^n)/(c + d*x)^n])) + b*(b*B^2*c*(-2*d*g + c*h)*n^2*
Log[c + d*x]^2 + 2*B*n*Log[c + d*x]*(A*b*c*(-2*d*g + c*h) + B*(b*c^2*h - a*d*(2*d*g + c*h))*n + b*B*c*(-2*d*g
+ c*h)*Log[(e*(a + b*x)^n)/(c + d*x)^n]) + d*(A*b*x*(2*A*d*g - 2*B*c*h*n + A*d*h*x) + 2*a*B*n*(-2*A*d*g - 2*B*
d*g*n + B*c*h*n + A*d*h*x) + 2*B*(a*B*d*n*(-2*g + h*x) + b*x*(2*A*d*g - B*c*h*n + A*d*h*x))*Log[(e*(a + b*x)^n
)/(c + d*x)^n] + b*B^2*d*x*(2*g + h*x)*Log[(e*(a + b*x)^n)/(c + d*x)^n]^2)) + 2*B^2*(b*c - a*d)*(-2*b*d*g + b*
c*h + a*d*h)*n^2*PolyLog[2, (d*(a + b*x))/(-(b*c) + a*d)])/(2*b^2*d^2)

Maple [F(-1)]

Timed out.

hanged

[In]

int((h*x+g)*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2,x)

[Out]

int((h*x+g)*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2,x)

Fricas [F]

\[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int { {\left (h x + g\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2} \,d x } \]

[In]

integrate((h*x+g)*(A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2,x, algorithm="fricas")

[Out]

integral(A^2*h*x + A^2*g + (B^2*h*x + B^2*g)*log((b*x + a)^n*e/(d*x + c)^n)^2 + 2*(A*B*h*x + A*B*g)*log((b*x +
 a)^n*e/(d*x + c)^n), x)

Sympy [F(-2)]

Exception generated. \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\text {Exception raised: HeuristicGCDFailed} \]

[In]

integrate((h*x+g)*(A+B*ln(e*(b*x+a)**n/((d*x+c)**n)))**2,x)

[Out]

Exception raised: HeuristicGCDFailed >> no luck

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 903 vs. \(2 (289) = 578\).

Time = 0.71 (sec) , antiderivative size = 903, normalized size of antiderivative = 3.07 \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=A B h x^{2} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + \frac {1}{2} \, A^{2} h x^{2} + 2 \, A B g x \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A^{2} g x + \frac {2 \, {\left (\frac {a e n \log \left (b x + a\right )}{b} - \frac {c e n \log \left (d x + c\right )}{d}\right )} A B g}{e} - \frac {{\left (\frac {a^{2} e n \log \left (b x + a\right )}{b^{2}} - \frac {c^{2} e n \log \left (d x + c\right )}{d^{2}} + \frac {{\left (b c e n - a d e n\right )} x}{b d}\right )} A B h}{e} - \frac {{\left (a c d h n^{2} + {\left (2 \, c d g n \log \left (e\right ) - {\left (h n^{2} + h n \log \left (e\right )\right )} c^{2}\right )} b\right )} B^{2} \log \left (d x + c\right )}{b d^{2}} + \frac {{\left (2 \, a b d^{2} g n^{2} - a^{2} d^{2} h n^{2} - {\left (2 \, c d g n^{2} - c^{2} h n^{2}\right )} b^{2}\right )} {\left (\log \left (b x + a\right ) \log \left (\frac {b d x + a d}{b c - a d} + 1\right ) + {\rm Li}_2\left (-\frac {b d x + a d}{b c - a d}\right )\right )} B^{2}}{b^{2} d^{2}} + \frac {B^{2} b^{2} d^{2} h x^{2} \log \left (e\right )^{2} + 2 \, {\left (2 \, c d g n^{2} - c^{2} h n^{2}\right )} B^{2} b^{2} \log \left (b x + a\right ) \log \left (d x + c\right ) - {\left (2 \, c d g n^{2} - c^{2} h n^{2}\right )} B^{2} b^{2} \log \left (d x + c\right )^{2} - {\left (2 \, a b d^{2} g n^{2} - a^{2} d^{2} h n^{2}\right )} B^{2} \log \left (b x + a\right )^{2} + 2 \, {\left (a b d^{2} h n \log \left (e\right ) - {\left (c d h n \log \left (e\right ) - d^{2} g \log \left (e\right )^{2}\right )} b^{2}\right )} B^{2} x + 2 \, {\left ({\left (h n^{2} - h n \log \left (e\right )\right )} a^{2} d^{2} - {\left (c d h n^{2} - 2 \, d^{2} g n \log \left (e\right )\right )} a b\right )} B^{2} \log \left (b x + a\right ) + {\left (B^{2} b^{2} d^{2} h x^{2} + 2 \, B^{2} b^{2} d^{2} g x\right )} \log \left ({\left (b x + a\right )}^{n}\right )^{2} + {\left (B^{2} b^{2} d^{2} h x^{2} + 2 \, B^{2} b^{2} d^{2} g x\right )} \log \left ({\left (d x + c\right )}^{n}\right )^{2} + 2 \, {\left (B^{2} b^{2} d^{2} h x^{2} \log \left (e\right ) - {\left (2 \, c d g n - c^{2} h n\right )} B^{2} b^{2} \log \left (d x + c\right ) + {\left (a b d^{2} h n - {\left (c d h n - 2 \, d^{2} g \log \left (e\right )\right )} b^{2}\right )} B^{2} x + {\left (2 \, a b d^{2} g n - a^{2} d^{2} h n\right )} B^{2} \log \left (b x + a\right )\right )} \log \left ({\left (b x + a\right )}^{n}\right ) - 2 \, {\left (B^{2} b^{2} d^{2} h x^{2} \log \left (e\right ) - {\left (2 \, c d g n - c^{2} h n\right )} B^{2} b^{2} \log \left (d x + c\right ) + {\left (a b d^{2} h n - {\left (c d h n - 2 \, d^{2} g \log \left (e\right )\right )} b^{2}\right )} B^{2} x + {\left (2 \, a b d^{2} g n - a^{2} d^{2} h n\right )} B^{2} \log \left (b x + a\right ) + {\left (B^{2} b^{2} d^{2} h x^{2} + 2 \, B^{2} b^{2} d^{2} g x\right )} \log \left ({\left (b x + a\right )}^{n}\right )\right )} \log \left ({\left (d x + c\right )}^{n}\right )}{2 \, b^{2} d^{2}} \]

[In]

integrate((h*x+g)*(A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2,x, algorithm="maxima")

[Out]

A*B*h*x^2*log((b*x + a)^n*e/(d*x + c)^n) + 1/2*A^2*h*x^2 + 2*A*B*g*x*log((b*x + a)^n*e/(d*x + c)^n) + A^2*g*x
+ 2*(a*e*n*log(b*x + a)/b - c*e*n*log(d*x + c)/d)*A*B*g/e - (a^2*e*n*log(b*x + a)/b^2 - c^2*e*n*log(d*x + c)/d
^2 + (b*c*e*n - a*d*e*n)*x/(b*d))*A*B*h/e - (a*c*d*h*n^2 + (2*c*d*g*n*log(e) - (h*n^2 + h*n*log(e))*c^2)*b)*B^
2*log(d*x + c)/(b*d^2) + (2*a*b*d^2*g*n^2 - a^2*d^2*h*n^2 - (2*c*d*g*n^2 - c^2*h*n^2)*b^2)*(log(b*x + a)*log((
b*d*x + a*d)/(b*c - a*d) + 1) + dilog(-(b*d*x + a*d)/(b*c - a*d)))*B^2/(b^2*d^2) + 1/2*(B^2*b^2*d^2*h*x^2*log(
e)^2 + 2*(2*c*d*g*n^2 - c^2*h*n^2)*B^2*b^2*log(b*x + a)*log(d*x + c) - (2*c*d*g*n^2 - c^2*h*n^2)*B^2*b^2*log(d
*x + c)^2 - (2*a*b*d^2*g*n^2 - a^2*d^2*h*n^2)*B^2*log(b*x + a)^2 + 2*(a*b*d^2*h*n*log(e) - (c*d*h*n*log(e) - d
^2*g*log(e)^2)*b^2)*B^2*x + 2*((h*n^2 - h*n*log(e))*a^2*d^2 - (c*d*h*n^2 - 2*d^2*g*n*log(e))*a*b)*B^2*log(b*x
+ a) + (B^2*b^2*d^2*h*x^2 + 2*B^2*b^2*d^2*g*x)*log((b*x + a)^n)^2 + (B^2*b^2*d^2*h*x^2 + 2*B^2*b^2*d^2*g*x)*lo
g((d*x + c)^n)^2 + 2*(B^2*b^2*d^2*h*x^2*log(e) - (2*c*d*g*n - c^2*h*n)*B^2*b^2*log(d*x + c) + (a*b*d^2*h*n - (
c*d*h*n - 2*d^2*g*log(e))*b^2)*B^2*x + (2*a*b*d^2*g*n - a^2*d^2*h*n)*B^2*log(b*x + a))*log((b*x + a)^n) - 2*(B
^2*b^2*d^2*h*x^2*log(e) - (2*c*d*g*n - c^2*h*n)*B^2*b^2*log(d*x + c) + (a*b*d^2*h*n - (c*d*h*n - 2*d^2*g*log(e
))*b^2)*B^2*x + (2*a*b*d^2*g*n - a^2*d^2*h*n)*B^2*log(b*x + a) + (B^2*b^2*d^2*h*x^2 + 2*B^2*b^2*d^2*g*x)*log((
b*x + a)^n))*log((d*x + c)^n))/(b^2*d^2)

Giac [F]

\[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int { {\left (h x + g\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2} \,d x } \]

[In]

integrate((h*x+g)*(A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2,x, algorithm="giac")

[Out]

integrate((h*x + g)*(B*log((b*x + a)^n*e/(d*x + c)^n) + A)^2, x)

Mupad [F(-1)]

Timed out. \[ \int (g+h x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2 \, dx=\int \left (g+h\,x\right )\,{\left (A+B\,\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )\right )}^2 \,d x \]

[In]

int((g + h*x)*(A + B*log((e*(a + b*x)^n)/(c + d*x)^n))^2,x)

[Out]

int((g + h*x)*(A + B*log((e*(a + b*x)^n)/(c + d*x)^n))^2, x)